using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Communication_KcpFileTransfer_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Communication.KcpFileTransfer);
            args = new Type[]{typeof(System.String)};
            method = type.GetMethod("GetFileInfo", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetFileInfo_0);
            args = new Type[]{typeof(System.String), typeof(System.String), typeof(System.String)};
            method = type.GetMethod("Download", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Download_1);
            args = new Type[]{typeof(System.String), typeof(System.String), typeof(System.String)};
            method = type.GetMethod("Upload", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Upload_2);

            field = type.GetField("PartLength", flag);
            app.RegisterCLRFieldGetter(field, get_PartLength_0);
            app.RegisterCLRFieldSetter(field, set_PartLength_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_PartLength_0, AssignFromStack_PartLength_0);
            field = type.GetField("downloads", flag);
            app.RegisterCLRFieldGetter(field, get_downloads_1);
            app.RegisterCLRFieldSetter(field, set_downloads_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_downloads_1, AssignFromStack_downloads_1);
            field = type.GetField("uploads", flag);
            app.RegisterCLRFieldGetter(field, get_uploads_2);
            app.RegisterCLRFieldSetter(field, set_uploads_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_uploads_2, AssignFromStack_uploads_2);


            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Communication.KcpFileTransfer[s]);

            args = new Type[]{typeof(huqiang.Communication.KcpLink)};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* GetFileInfo_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @url = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Communication.KcpFileTransfer instance_of_this_method = (huqiang.Communication.KcpFileTransfer)typeof(huqiang.Communication.KcpFileTransfer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.GetFileInfo(@url);

            return __ret;
        }

        static StackObject* Download_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @msg = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.String @savePath = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.String @url = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            huqiang.Communication.KcpFileTransfer instance_of_this_method = (huqiang.Communication.KcpFileTransfer)typeof(huqiang.Communication.KcpFileTransfer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Download(@url, @savePath, @msg);

            return __ret;
        }

        static StackObject* Upload_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @msg = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.String @filePath = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.String @url = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            huqiang.Communication.KcpFileTransfer instance_of_this_method = (huqiang.Communication.KcpFileTransfer)typeof(huqiang.Communication.KcpFileTransfer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Upload(@url, @filePath, @msg);

            return __ret;
        }


        static object get_PartLength_0(ref object o)
        {
            return huqiang.Communication.KcpFileTransfer.PartLength;
        }

        static StackObject* CopyToStack_PartLength_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = huqiang.Communication.KcpFileTransfer.PartLength;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_PartLength_0(ref object o, object v)
        {
            huqiang.Communication.KcpFileTransfer.PartLength = (System.Int32)v;
        }

        static StackObject* AssignFromStack_PartLength_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @PartLength = ptr_of_this_method->Value;
            huqiang.Communication.KcpFileTransfer.PartLength = @PartLength;
            return ptr_of_this_method;
        }

        static object get_downloads_1(ref object o)
        {
            return ((huqiang.Communication.KcpFileTransfer)o).downloads;
        }

        static StackObject* CopyToStack_downloads_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.KcpFileTransfer)o).downloads;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_downloads_1(ref object o, object v)
        {
            ((huqiang.Communication.KcpFileTransfer)o).downloads = (System.Collections.Generic.List<huqiang.Communication.KcpFileMission>)v;
        }

        static StackObject* AssignFromStack_downloads_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Collections.Generic.List<huqiang.Communication.KcpFileMission> @downloads = (System.Collections.Generic.List<huqiang.Communication.KcpFileMission>)typeof(System.Collections.Generic.List<huqiang.Communication.KcpFileMission>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Communication.KcpFileTransfer)o).downloads = @downloads;
            return ptr_of_this_method;
        }

        static object get_uploads_2(ref object o)
        {
            return ((huqiang.Communication.KcpFileTransfer)o).uploads;
        }

        static StackObject* CopyToStack_uploads_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.KcpFileTransfer)o).uploads;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_uploads_2(ref object o, object v)
        {
            ((huqiang.Communication.KcpFileTransfer)o).uploads = (System.Collections.Generic.List<huqiang.Communication.KcpFileMission>)v;
        }

        static StackObject* AssignFromStack_uploads_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Collections.Generic.List<huqiang.Communication.KcpFileMission> @uploads = (System.Collections.Generic.List<huqiang.Communication.KcpFileMission>)typeof(System.Collections.Generic.List<huqiang.Communication.KcpFileMission>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Communication.KcpFileTransfer)o).uploads = @uploads;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.KcpLink @link = (huqiang.Communication.KcpLink)typeof(huqiang.Communication.KcpLink).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = new huqiang.Communication.KcpFileTransfer(@link);

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
